//
//  TestAutoCollectionCell.swift
//  CooperSwift_Example
//
//  Created by 计海峰 on 2021/6/10.
//  Copyright © 2021 CocoaPods. All rights reserved.
//

import UIKit
import HandyJSON
import RxSwift

class TestAutoCollectionCell: UICollectionViewCell {
    
    @IBOutlet weak var btn: UIButton!
    
    let bag = DisposeBag()
    
    @IBAction func btnTap(_ sender: Any) {
        guard let info = self.info as? TestCollectionCellModel else { return }
        info.post("sumbit")
        
//        EnterpriseProvider.rx.request(.showCity("340000")).asObservable().mapHandyModelArray(type: CityModel.self).subscribe(onNext: { citys in
//            
//            citys?.forEach({ c in
//                
//                log.debug(c?.city)
//                
//            })
//            
//        }).disposed(by: bag)
        
//        EnterpriseProvider.rx.request(.showCity("34000")).subscribe { str in
//
//        } onFailure: { error in
//
//        } onDisposed: {
//
//        }.disposed(by: bag)
//
//
//        EnterpriseProvider.rx.request(.showCity("34000")).mapString().subscribe { str in
//            log.info(str)
//            [ProvinceModel].deserialize(from: str)?.forEach({ p in
//                print(p?.province)
//            })
//        } onFailure: { error in
//            log.error(error)
//        } onDisposed: {
//            print("onDisposed")
//        }.disposed(by: bag)

            
            
            
//            .subscribe { result in
//            [ProvinceModel].deserialize(from: result.mapString())?.forEach({ p in
//                print(p?.province)
//            })
//        } onFailure: { error in
//
//
//            print(error)
//        } onDisposed: {
//            print("onDisposed")
//        }

        
//            print(type(of: result))

//            [ProvinceModel].deserialize(from: String(result))

    }
    
    override func bindTo(_ info: Any?) {
        super.bindTo(info)
        
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        contentView.backgroundColor = .random()
    }

}
